package com.multiple.sources.core.servie.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.multiple.sources.core.bean.User;
import com.multiple.sources.core.config.DbContextHolder;
import com.multiple.sources.core.mapper.UserMapper;
import com.multiple.sources.core.servie.api.IUserService;

/**
 * <p>
 *   服务实现类
 * </p>
 *
 * @author limao
 * @since 2017-08-31
 */
@Service
public class UserServiceImpl implements IUserService {
	@Autowired
	private UserMapper userMapper;

	@Override
	public int deleteByPrimaryKey(Long id) {
		// TODO Auto-generated method stub
		return userMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(User record) {
		// TODO Auto-generated method stub
		return userMapper.insert(record);
	}

	@Override
	public int insertSelective(User record) {
		// TODO Auto-generated method stub
		return userMapper.insertSelective(record);
	}

	@Override
	public User selectByPrimaryKey(Long id) {
		// TODO Auto-generated method stub
		return userMapper.selectByPrimaryKey(id);
	}

	@Override
	public int updateByPrimaryKeySelective(User record) {
		// TODO Auto-generated method stub
		return userMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(User record) {
		// TODO Auto-generated method stub
		return userMapper.updateByPrimaryKey(record);
	}

	@Override
	public List<User> selectAll() {
		// TODO Auto-generated method stub
		System.out.println(" UserServiceImpl  当前数据源："+DbContextHolder.getDBType());
		return userMapper.selectAll();
	}
	
	
}
